

#include "s3c2440_soc.h"

int main(void)
{

    // s2(GPF0) s3(GPF2)  s4(GPG3) 设置为输入
    GPFCON &= ~((3 << 0) | (3 << 4));
    GPGCON &= ~(3 << 6);

    // nLED1(GPF4)   nLED2(GPF5)  nLED4(GPF6)
    GPFCON &= ~((3 << 8) | (3 << 10) | (3 << 12));
    GPFCON |= ((1 << 8) | (1 << 10) | (1 << 12));

    int val1, val2;

    while (1)
    {
        val1 = GPFDAT;
        val2 = GPGDAT;

        if (val1 & (1 << 0)) // 松开
        {
            GPFDAT |= (1 << 4);
        }
        else
        {
            GPFDAT &= ~(1 << 4);
        }

        if (val1 & (1 << 2))
        {
            GPFDAT |= (1 << 5);
        }
        else
        {
            GPFDAT &= ~(1 << 5);
        }

        if (val2 & (1 << 3))
        {
            GPFDAT |= (1 << 6);
        }
        else
        {
            GPFDAT &= ~(1 << 6);
        }
    }

    return 0;
}